<?php
$choice = $_GET['ch'];
$mysql = new SaeMysql();

switch ($choice) {
	case '1':
		$name = $_GET['search'];
		$sql = "SELECT * FROM `info` WHERE `name` LIKE '%{$name}%'";
		$data = $mysql->getData($sql);
		echo $_GET['jsoncallback']."(".json_encode($data).")";
		break;

	case '2':
		$teacher = $_GET['search'];
		$sql = "SELECT * FROM `info` WHERE `teacher` = '{$teacher}'";
		$data = $mysql->getData($sql);
		echo $_GET['jsoncallback']."(".json_encode($data).")";
		break;
	
	default:
		break;
}
?>